<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //面向对象
        let student={
            name:"唐玮",
            grade:[
                {
                    name:"java",
                    score:90
                    
                }
                ,{
                    name:"javascript",
                    score:80
                }
            ],
            //平时成绩的方法
            avg_grade(){
               let totle=this.grade.reduce((t,l)=>t+l.score,0);
                 return `${this.name}的平时成绩为:${totle/this.grade.length}`;
            }
        };
        console.log(student.avg_grade());


        
    </script>
</body>
</html>